package com.zkthink.ceres.promotion.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.zkthink.base.entity.Entity;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.zkthink.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 用户领券表
 * </p>
 *
 * @author JustArgo
 * @since 2020-06-26
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ceres_member_coupon")
@ApiModel(value = "MemberCoupon", description = "用户领券表")
@AllArgsConstructor
public class MemberCoupon extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    /**
     * 会员ID
     */
    @ApiModelProperty(value = "会员ID")
    @NotNull(message = "会员ID不能为空")
    @TableField("mid")
    @Excel(name = "会员ID")
    private Long mid;

    /**
     * 优惠券id
     */
    @ApiModelProperty(value = "优惠券id")
    @NotNull(message = "优惠券id不能为空")
    @TableField("coupon_id")
    @Excel(name = "优惠券id")
    private Long couponId;

    /**
     * 领取时间
     */
    @ApiModelProperty(value = "领取时间")
    @NotNull(message = "领取时间不能为空")
    @TableField("receive_time")
    @Excel(name = "领取时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime receiveTime;

    /**
     * 使用时间
     */
    @ApiModelProperty(value = "使用时间")
    @TableField("use_time")
    @Excel(name = "使用时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime useTime;

    /**
     * 删除状态(1删除,0未删除)
     */
    @ApiModelProperty(value = "删除状态(1删除,0未删除)")
    @NotNull(message = "删除状态(1删除,0未删除)不能为空")
    @TableField("is_deleted")
    @Excel(name = "删除状态(1删除,0未删除)", replace = {"是_true", "否_false", "_null"})
    private Boolean isDeleted;


    @Builder
    public MemberCoupon(Long id, LocalDateTime createTime, LocalDateTime updateTime, Long createUser, Long updateUser, 
                    Long mid, Long couponId, LocalDateTime receiveTime, LocalDateTime useTime, Boolean isDeleted) {
        this.id = id;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.createUser = createUser;
        this.updateUser = updateUser;
        this.mid = mid;
        this.couponId = couponId;
        this.receiveTime = receiveTime;
        this.useTime = useTime;
        this.isDeleted = isDeleted;
    }

}
